<!--
 * @description  :窝点情报详情
 * @descriptionDetail:窝点情报详情
 * @copyright    : 浙江烟草
 * @author       : dw
 * @create       : 2022-10-09 22:21:21
-->
<template>
  <view class="page">
    <!-- #ifdef H5-ONLY -->
    <theme-navbar title="窝点情报维护">
    </theme-navbar>
    <!-- #endif -->
    <view class="content content-bg ifn-content" style="background-color: white; margin-left='10rpx'">
      <u-form
        class="u-form-m"
        :label-style="labelStyle"
        :model="baseInfo"
        :error-type="['border-bottom', 'message',]"
        label-width="auto"
        label-position="top"
        ref="uForm"
      >
        <u-form-item label="窝点名称">
          <u-input
            v-model="baseInfo.name"
            :disabled="true"
            placeholder=""
          >
          </u-input>
        </u-form-item>
        <u-form-item label="登记单位">
          <u-input
            v-model="baseInfo.orgName"
            :disabled="true"
            placeholder=""
          >
          </u-input>
        </u-form-item>
        <u-form-item label="窝点类型">
          <u-input
            v-model="baseInfo.typeName"
            :disabled="true"
            placeholder=""
          >
          </u-input>
        </u-form-item>
        <u-form-item label="窝点小类">
          <u-input
            v-model="baseInfo.subtypeName"
            :disabled="true"
            placeholder=""
          >
          </u-input>
        </u-form-item>
        <u-form-item label="窝点持有人">
          <u-input
            v-model="baseInfo.handler"
            :disabled="true"
            placeholder=""
          >
          </u-input>
        </u-form-item>
        <u-form-item label="窝点管理人">
          <u-input
            v-model="baseInfo.manager"
            :disabled="true"
            placeholder=""
          >
          </u-input>
        </u-form-item>
        <u-form-item label="所在地">
          <u-input
            v-model="baseInfo.local"
            :disabled="true"
            placeholder=""
          >
          </u-input>
        </u-form-item>
        <u-form-item label="窝点地址">
          <u-input
            v-model="baseInfo.address"
            :disabled="true"
            placeholder=""
          >
          </u-input>
        </u-form-item>
        <u-form-item prop="placeGis" label="经纬度">
          <u-input
            v-model="baseInfo.lonlat"
            :disabled="true"
            placeholder=""
          >
          </u-input>
        </u-form-item>
        <u-form-item label="所属网格">
          <u-input
            v-model="baseInfo.gridName"
            :disabled="true"
            placeholder=""
          >
          </u-input>
        </u-form-item>
        <u-form-item label="活动规律">
          <u-input
            v-model="baseInfo.law"
            :disabled="true"
            placeholder=""
          >
          </u-input>
        </u-form-item>
        <u-form-item label="窝点状态">
          <u-input
            v-model="baseInfo.statusName"
            :disabled="true"
            placeholder=""
          >
          </u-input>
        </u-form-item>
        <u-form-item label="备注" :border-bottom="false">
          <u-input
            v-model="baseInfo.remark"
            :disabled="true"
            type="textarea"
            placeholder=""
          >
          </u-input>
        </u-form-item>
      </u-form>
    </view>
    <view class="content u-page">
      <u-gap :height="$theme.cm_section_top_gap_height" :bg-color="$theme.cm_gap_color"></u-gap>
      <fsection :title="title.images" :customStyle="customStyle"></fsection>
      <view class="u-form-m pl-10">
        <m-upload
          maxCount="99"
          :file-list="imgList"
          :disabled="true"
          :deletable="false"
          upApiUrl="uploadBase64File"
          :uploadParam="{'fiGroupCode':$FILE_GROUP_TYPE.k_den_attr}"
        >
        </m-upload>
        <u-image
          width="100%"
          v-if="!imgList.length"
          height="330rpx"
          style="padding:0 0 34rpx 14rpx"
          mode="scaleToFill"
          :src="'/static/certificate/noImg.png'"
        >
        </u-image>
      </view>
    </view>
    <view class="u-page">
      <u-gap :height="$theme.cm_section_top_gap_height" :bg-color="$theme.cm_gap_color"></u-gap>
      <fsection :title="title.connect" :customStyle="customStyle"></fsection>
      <list-view
        :i="0"
        :index="0"
        :load-data="loadCase"
        :init-load="false"
        height="300px"
        :noMoreDataTipShow="false"
        ref="mescrollItem0"
        class="specailListview"
      >
        <template slot-scope="d">
          <caseConnection :connection="d.data" class="case-sty"></caseConnection>
        </template>
      </list-view>
    </view>
  </view>
</template>

<script>
import listView from '@/components/list_view.vue';
import fsection from "@/components/form-section.vue";
import caseConnection from '../components/caseConnection.vue';
import intelligenceservice from "@/service/intelligence/intelligence.service";
import mUpload from '@/components/m-upload.vue';
import certificateService from "@/service/certificate/certificate.service.js";
export default {
  components: {
    listView,
    fsection,
    caseConnection,
    mUpload,
  },
  data() {
    return {
      customStyle:{
        padding:"20rpx 32rpx",
      },
      baseInfo: {
        name:"",// 窝点名称
        orgUuid:"",// 登记单位Uuid
        orgName:"",// 登记单位
        type:"", // 窝点类型
        typeStr:"",// 窝点类型文字
        subtype:"",// 窝点小类
        subtypeStr:'',
        handler:"",// 窝点持有人
        manager:"",// 管理人
        denProvCityCounty:"",// 所在地
        prov:"",// 省份
        city:"",// 市
        county:"",// 区（县、乡）
        address:"",// 窝点地址
        lonlat:"",// 经纬度
        law:"",// 活动规律
        remark:"",// 备注
        grid:"", // 所属网格
      },
      labelStyle: {
        fontWeight: 400,
        color: this.$theme.u_main_color,
        fontSize: '.75rem',
      },
      title:{
        images:"图片信息",
        connect:"案件关联",
        connectMsg:"窝点情报详情",
      },
      casedata:"",
      imgList:[],
    }
  },
  computed:{
  },
  onReady() {
    this.$refs.uForm.setRules(this.rules);
  },
  onLoad(opt){
    this.loadData();
  },
  mounted(){
    this.initAuditImage();
  },
  methods: {
    getListViewHeight() {
      let p = (this.$u.sys().windowHeight - 44 - 48 - uni.upx2px(10) - this.$u.sys().statusBarHeight) + "px";
      // #ifdef H5-DINGDING || H5-WECHAT
      p = (this.$u.sys().windowHeight - uni.upx2px(10) - 48 - this.$u.sys().statusBarHeight) + "px";
      // #endif
      return p;
    },
    loadData(){
      this.baseInfo = this.getRouteParam();
      if (this.$u.test.isEmpty(this.baseInfo.longitude) && this.$u.test.isEmpty(this.baseInfo.latitude)) {
        this.baseInfo.lonlat = "";
      } else {
        this.baseInfo.lonlat = `${this.baseInfo.longitude},${this.baseInfo.latitude}`;
      }
      if (this.$u.test.isEmpty(this.baseInfo.city) && this.$u.test.isEmpty(this.baseInfo.county)) {
        this.baseInfo.local = this.baseInfo.provName;
      } else if (this.$u.test.isEmpty(this.baseInfo.county)) {
        this.baseInfo.local = this.baseInfo.provName + "/" + this.baseInfo.cityName;
      } else if (!this.$u.test.isEmpty(this.baseInfo.county)){
        this.baseInfo.local = this.baseInfo.provName + "/" + this.baseInfo.cityName + "/" + this.baseInfo.countyName;
      } else if (!this.$u.test.isEmpty(this.baseInfo.prov)){
        this.baseInfo.local = "";
      }
    },
    initAuditImage(){
      certificateService.goFiles(this.baseInfo.uuid,this.$FILE_GROUP_TYPE.k_den_attr).then(res => {
        if(res.success) this.imgList = res.data;
      }).catch(e => {
        console.log(e);
      })
    },
    loadCase(page){
      return new Promise((resolve,reject) => {
        let params = {
          page:page.num,
          limit:page.size,
          paras:{
            archiveUuid:this.baseInfo.uniqueKey,
            type: "den-case",
          },
        }
        intelligenceservice.archiveCaseList(params).then(res => {
          if(res.success){
            resolve({ data: {list: res.data, totalCount : res.count,},});
          }else{
            this.$modal.alert(res.msg);
            resolve({ data: {list: [], totalCount : 0,},});
          }
        }).catch(e => {
          this.$u.toast('请求失败:' + e);
          resolve({
            count: 0,
            data:[],
          });
        });
      })
    },
    loadImg(){
      let params = {
        bizId:this.baseInfo.uuid,
      }
    },
  },
}
</script>

<style scoped lang="scss">
@import "./add.scss";
.page{
  padding: 0;
}
.list-item-root{
		border-bottom: 1px solid $u-border-color;
}
.list-lay{
		padding: $cm-conent-padding-column $cm-content-paddng-row;
}
.m-preview-image {
		display: block;
		width: 100%;
		height: 100%;
		border-radius: 10rpx;
	}
</style>
